package com.itheima.heimaai.entity.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.MessageType;

@Data
@NoArgsConstructor
public class MessageVO {
    private String role;
    private String content;

    public MessageVO(Message message){
        MessageType messageType = message.getMessageType();
        if (messageType == MessageType.USER){
            role = "user";
        }
        if (messageType == MessageType.ASSISTANT){
            role = "assistant";
        }
        content = message.getText();
    }
}
